package com.bynk.bynk_demo.controller;

import com.bynk.bynk_demo.common.result.Result;
import com.bynk.bynk_demo.dto.TypeDto;
import com.bynk.bynk_demo.model.Book;
import com.bynk.bynk_demo.model.BookType;
import com.bynk.bynk_demo.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/type")
@CrossOrigin
public class TypeController {
    @Autowired
    private TypeService typeService;

    @GetMapping("/init")
    public Result getAllType(){
        return Result.success(typeService.getAllType());
    }
    @PostMapping("/add")
    public Result addType(BookType bookType){
        return Result.success(typeService.addType(bookType));
    }
}
